{extend name="adminblue/base" /}
{block name="main"}
<div class="set-style">
	<dl>
		<dt>注册送积分:</dt>
		<dd>
			<p><input id="reg_member_self_point" type="text" value="{$res.reg_member_self_point}" class="input-common"></p>
			<p class="error">请输入阿里旺旺</p>
		</dd>
	</dl>
	<dl>
		<dt>签到送积分:</dt>
		<dd>
			<p><input id="sign_point" type="text" value="{$res.sign_point}" class="input-common"></p>
			<p class="error">请输入阿里旺旺</p>
		</dd>
	</dl>
	<dl>
		<dt>分享送积分:</dt>
		<dd>
			<p><input id="share_point" type="text" value="{$res.share_point}" class="input-common"></p>
			<p class="error">请输入阿里旺旺</p>
		</dd>
	</dl>
	<dl>
		<dt>进店领用优惠劵:</dt>
		<dd>
			<p>
				<select id="into_store_coupon" class="select-common">
					<option value="0">选择优惠劵</option>
					{volist name="coupon" id="vo"}
					<option value="{$vo.coupon_type_id}" {if condition="$vo['coupon_type_id'] eq $res['into_store_coupon']"}selected="selected"{/if}>{$vo.coupon_name}</option>
					{/volist}
				</select>	
			</p>
			<p class="error">请输入阿里旺旺</p>
		</dd>
	</dl>
	<dl>
		<dt>分享领用优惠劵:</dt>
		<dd>
			<p>
				<select id="share_coupon" class="select-common">
					<option value="0">选择优惠劵</option>
					{volist name="coupon" id="vo"}
					<option value="{$vo.coupon_type_id}" {if condition="$vo['coupon_type_id'] eq $res['share_coupon']"}selected="selected"{/if}>{$vo.coupon_name}</option>
					{/volist}
				</select>
			</p>
			<p class="error">请输入阿里旺旺</p>
		</dd>
	</dl>
	<dl>
		<dt></dt>
		<dd><button class="btn-common btn-big" onclick="setRewardRuleAjax();">提交</button></dd>
	</dl>
</div>
<script>
function setRewardRuleAjax(){
	var sign_point = $("#sign_point").val();
	var share_point = $("#share_point").val();
	var into_store_coupon = $("#into_store_coupon").val();
	var share_coupon = $("#share_coupon").val();
	var reg_member_self_point = $("#reg_member_self_point").val();
	$.ajax({
		type : 'post',
		url : "{:__URL('ADMIN_MAIN/config/bonuses')}",
		data : {
			"sign_point" : sign_point,
			"share_point" : share_point,
			"into_store_coupon" : into_store_coupon,
			"share_coupon" : share_coupon,
			"reg_member_self_point" : reg_member_self_point
		},
		success : function(data){
			if(data['code'] >0){
				location.href=__URL("ADMIN_MAIN/config/bonuses");
			}else{
				showMessage("error", "设置失败");
			}
		}
	})
}
</script>
{/block}